<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>{$city_name}{$category_name}资质代办公司_中介公司-奇快企服</title>
		<meta name="applicable-device" content="mobile">
		<meta content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,shrink-to-fit=no,user-scalable=no,minimal-ui" name="viewport">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="keywords" content="{$city_name}{$category_name}资质代办公司,{地域}{资质类型}资质办理中介">
    	<meta name="description" content="上奇快企服平台找{$city_name}{$category_name}资质代办公司，汇集上千家建筑资质代办中介公司，建筑企业可快速获取多家中介公司资质代办服务咨询，{$city_name}{$category_name}资质代办费用，方便挑选最优质资质代办公司">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta content="telephone=no" name="format-detection">
		<!-- UC默认竖屏` UC强制全屏 -->
		<meta name="full-screen" content="yes">
		<meta name="browsermode" content="application">
		<link rel="icon" href="/icon.png" />
		<!-- QQ强制竖屏` QQ强制全屏 -->

		<link rel="stylesheet" href="/static/wap/lib/mui.min.css" />
		<link rel="stylesheet" href="/static/wap/lib/mui.picker.min.css" />

		<link rel="stylesheet" href="/static/wap/css/common.css" />
		<link rel="stylesheet" href="/static/wap/css/company.css" />

		<link rel="stylesheet" href="/static/wap/css/reset.css" />

		<script type="text/javascript" src="/static/wap/lib/jquery-2.1.4.js"></script>
		<script type="text/javascript" src="/static/wap/lib/mui.min.js"></script>
		<script type="text/javascript" src="/static/wap/lib/mui.picker.min.js"></script>
		<script type="text/javascript" src="/static/wap/lib/template.js"></script>
		<style type="text/css">
			.mui-backdrop{z-index: 100;}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a href="/wap/" class="mui-icon mui-icon-back" style="color: #fff;"></a>
			<h1 class="mui-title">奇快企服</h1>
		</header>

		<div class="nav_title" style="margin-top: 50px;">
			<span class="title_name">首页</span>
			<span class="mui-icon mui-icon-forward"></span>
			<span class="title_name">资质代办</span>
		</div>

		<div class="mui-content borderBottom borderTop chooseWrap" style="padding-top: 0;">
			<div class="mui-row">
				<div class="mui-col-sm-4 mui-col-xs-4">
					<div class="mui-table-view-cell tapChoose borderRight" id="cityChoose">
						省市/地区
					</div>
				</div>
				<div class="mui-col-sm-4 mui-col-xs-4">
					<div class="mui-table-view-cell tapChoose borderRight" id="catGeryChoose">
						资质类型
					</div>
				</div>
				<div class="mui-col-sm-4 mui-col-xs-4">
					<div class="mui-table-view-cell tapChoose" id="listChoose">
						综合排序
					</div>
				</div>
			</div>
		</div>
		
		<div class="company_container">
			<div id="companyHtml"></div>
			<script id="companyScript" type="text/html">
	    		{{each list item i}} 
					<div class="company_wrap borderBottom">
						<img src="{{item.logo}}" class="company_pic mui-pull-left" />
						<div class="companyDt mui-pull-left">
							<div class="company_title">{{item.name}}</div>
							<div class="company_desc">
								已咨询：<span>{{item.view_num}}</span>&nbsp;&nbsp;&nbsp;&nbsp;服务评分：<span>{{item.star}}</span>
							</div>
							<a href="/wap/company/{{item.id}}" class="getPrice">免费咨询报价</a>
						</div>
					</div>
				{{/each}}
		     </script>
		</div>
		
		<div class="page_wrap">
			<div class="page_box">
				<div class="pageItem" onclick="prevPageFun()">上一页</div>
				<div class="pageItem pageNumBox" id="pageBox">1/4</div>
				<div class="pageItem active" onclick="nextPage()">下一页</div>
			</div>
		</div>
		
		{include file="pub/footer"}
		
		<div class="dailogContainer"></div>
		<div class="dailogWrap catgeryWrap">
			<div class="listDateWrap">
				<div class="dailogTitle">资质类别</div>

				<ul class="listContainer" id="OneCategoryHtml">
					
				</ul>

			</div>
			<div class="footerDailog">
				<div class="btnBotm cancleDailogBtn">取消</div>
				<div class="btnBotm sureDailogBtn">确定</div>
			</div>
		</div>

		<div class="dailogWrap listPaiWrap">
			<div class="listDateWrap">
				<div class="dailogTitle">排序方式</div>

				<ul class="listContainer" id="threeHtml">
					
				</ul>

			</div>
			<div class="footerDailog">
				<div class="btnBotm cancleDailogBtn">取消</div>
				<div class="btnBotm sureDailogBtn">确定</div>
			</div>
		</div>

		<div class="dailogWrap cityChooseWrap">
			<div class="listDateWrap">
				<div class="dailogTitle">省市/地区</div>

				<ul class="listContainer" id="OneCityHtml">
				</ul>

			</div>
			<div class="footerDailog">
				<div class="btnBotm cancleDailogBtn">取消</div>
				<div class="btnBotm sureDailogBtn">确定</div>
			</div>
		</div>

		<script type="text/javascript" src="/static/index/layer/layer.js"></script>
		<script>
			var stateList = {
		        name: "筛选条件",
		        listSta: [
		            {
		                id: 'multi',
		                name: '综合排序'
		            },
		            {
		                id: 'view',
		                name: '人气推荐'
		            },
		            {
		                id: 'star',
		                name: '优质服务'
		            }
		        ]
		    };

		    var cityList = { // 所有资质类别重新组成的数据
		        name: "城市列表",
		        cityListDta: []
		    };

			//callback为用户点击蒙版时自动执行的回调；
			var mask = mui.createMask(callback);
			var maskCity = mui.createMask(callbackCity);

			function callback(){
				$('.listPaiWrap').animate({right: "100%"});
			}
			function callbackCity(){
				$('.cityChooseWrap').animate({right: "100%"});
			}

			var baseUrl = 'https://api.qikuai100.com/',
			    categoriesList = { // 所有资质类别重新组成的数据
					name: "资质类别",
					cateList: []
				},
				dId = {$id},
				staId = '{$staId}', // 筛选
				idCity = {$idCity}, // 城市
				prevPage = 1, // 当前页
				totalPage = 1, // 总页数
				pageNum = 1;
			$(function(){
				/* 资质筛选 */
				$('#catGeryChoose').click(function(){
					$('.dailogContainer').show();
					$('.catgeryWrap').animate({right: "15%"});
				});
				$('.dailogContainer').click(function(){
					$('.dailogContainer').hide();
					$('.catgeryWrap').animate({right: "100%"});
				});
				$('.sureDailogBtn').click(function(){
					location.replace(location.href);
				});
				$('.cancleDailogBtn').click(function(){
					window.location.href = '/wap/gs/';
				});

				/* 排序筛选 */
				$('#listChoose').click(function(){
					mask.show();//显示遮罩
					$('.listPaiWrap').animate({right: "15%"});
				});

				/* 地区筛选 */
				$('#cityChoose').click(function(){
					maskCity.show();//显示遮罩
					$('.cityChooseWrap').animate({right: "15%"});
				});
				
				initChooseList();
				initCompList();
				stateFun();
				initCityList();
			});

			/**
		    * 三个排序方式
		    */
		    function stateFun(){
		        var html = '';
		        for(var i = 0;i < stateList.listSta.length; i++){
		            var chooseClass = '';
		            stateList.listSta[i].id == staId ? chooseClass = 'active' : chooseClass = '';
		            html += '<li class="' + chooseClass + '"><a href="/wap/gs/' + stateList.listSta[i].id + 'g'+ dId +'g'+ idCity +'">' + stateList.listSta[i].name + '</a></li>'
		        }
		        $('#threeHtml').html(html);
		    }

		    /**
		    * 初始化城市列表
		    */
		    function initCityList() {
		        $.ajax({
		            type: "POST",
		            url: baseUrl + "api/city/list",
		            data: {},
		            success: function(result) {
		                if (result.ret == 0) {
		                    cityList.cityListDta = result.data;
		                    var json = {
		                        dist_name: '不限',
		                        id: 0
		                    }
		                    cityList.cityListDta.unshift(json);
		                    var html = '';
		                    for (var i = 0; i < cityList.cityListDta.length; i++) {
		                        var chooseClass = '';
		                        cityList.cityListDta[i].id == idCity ? chooseClass = 'active' : chooseClass = '';
	                            html += '<li class="' + chooseClass + '" >' 
	                                 +      '<a href="/wap/gs/' + staId + 'g' + dId + 'g'+ cityList.cityListDta[i].id +'">' + cityList.cityListDta[i].dist_name + '</a>' 
	                                 +  '</li>';
	                        
		                    }
		                    $('#OneCityHtml').html(html);
		                }
		            }
		        });
		    }

			/**
			 * 资质筛选
			 * **/
			function initChooseList() {
				$.ajax({
					type: "POST",
					url: baseUrl + "api/category/list",
					data: {
						"type": 1
					},
					success: function(result) {
						if(result.ret == 0) {
							var dataL = result;

							for(var i = 0; i < result.data.length; i++) {
								for(var j = 0; j < result.data[i].subcategoy.length; j++) {
									categoriesList.cateList.push(result.data[i].subcategoy[j]);
								}
							}
							var json = {
								category_name: '不限',
								id: '0'
							}
							categoriesList.cateList.unshift(json);
							var htmlMore = '';
							for(var i = 0; i < categoriesList.cateList.length; i++) {
								var chooseClass = '';
								categoriesList.cateList[i].id == dId ? chooseClass = 'active' : chooseClass = '';
								  
								htmlMore += '<li class="' + chooseClass + '" >' +
									'<a href="/wap/gs/' + staId + 'g'+ categoriesList.cateList[i].id +'g'+ idCity +'">' + categoriesList.cateList[i].category_name + '</a>' +
									'</li>';
								
							}
							$('#OneCategoryHtml').html(htmlMore);
						}
					}
				});
			}

			//加载层
			var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
			function initCompList() {
        		// 获取资质分类详情代办公司
				$.ajax({
					type: "POST",
					url: baseUrl +"api/company/list", 
					data: {
						"id": dId,
						"page": pageNum,
						"dist_id": idCity,
                		"tag": staId
					}, 
					success: function(result) {
						layer.close(index);
						if(result.ret == 0) {
							console.log(result)
							// 公司数据
					        var htmlCompany = template('companyScript',result.data);
					        document.getElementById('companyHtml').innerHTML = htmlCompany;
					        totalPage = result.data.totalPage;
					        currentPage = result.data.currentPage;
					        $('#pageBox').html(currentPage+"/"+totalPage);
						}
					}
				});
            }

            function prevPageFun(){
				if(currentPage != 1){
					pageNum--;
					initCompList();
				}else{
					layer.msg("已经是第一页了")
				}
			}

			function nextPage(){
				if(currentPage < totalPage){
					pageNum++;
					initCompList();
				}else{
					layer.msg("已经是最后一页了")
				}
			}
		</script>
	
	</body>

</html>